//
//  File.swift
//
//
//  Created by didi on 2022/9/7.
//

import Vapor

public extension Application {
    private struct MolecularKey: StorageKey {
        typealias Value = Molecular
    }

    var molecular: Molecular {
        get {
            if let existing = storage[MolecularKey.self] { return existing }
            else {
                let new = Molecular(app: self)
                storage[MolecularKey.self] = new
                return new
            }
        }

        set { storage[MolecularKey.self] = newValue }
    }
}
